<%@ taglib uri="http://samplefn" prefix="myfn" %>
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<c:if test="${not empty errors}">
	<c:forEach items="${errors}" var="error">
		${error.category} - ${error.message}<br />
	</c:forEach>
</c:if>

<form action="${pageContext.request.contextPath}/publicacoes" method="post">
  
	<c:if test="${not empty publicacao.id}">
		<input type="hidden" name="publicacao.id" value="${publicacao.id}"/>
		<input type="hidden" name="_method" value="put"/>
	</c:if>

	<div class="field">
		Titulo:<br />
	
		<input type="text" name="publicacao.titulo" value="${publicacao.titulo}"/>
	</div>
	
	<div class="field">
		Conferencia:<br />
	
		<input type="text" name="publicacao.conferencia" value="${publicacao.conferencia}"/>
	</div>
	
	<div class="field">
		Ano:<br />
	
		<input type="text" name="publicacao.ano" value="${publicacao.ano}"/>
	</div>
	
	<div class="field">
		Projeto:<br />
		<select name="publicacao.projeto.id">    
			<option value="${0}"></option>
		  <c:forEach var="p" items="${projetos}">
		    <option value="${p.id}" ${p.id eq publicacao.projeto.id ? 'selected' : ''}>${p.titulo}</option>    
		  </c:forEach>    
		</select>  
	</div>
	
	<div class="field">
		Autores:<br />
		<select name="autores[]" multiple="multiple">
			<c:forEach var="c" items="${autores}">
		    	<option value="${c.id}" ${myfn:contains(publicacao.autores, c) ? 'selected' : ''}>${c}</option>
		  	</c:forEach>
		</select>	
	</div>	
	
  <div class="actions">
	  <button type="submit">enviar</button>
	</div>
</form>

<a href="${pageContext.request.contextPath}/publicacoes">Voltar</a>
